package yuejian_07.yuejian_07.fragment;

import android.content.Intent;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageButton;
import android.widget.Toast;

import com.jude.rollviewpager.RollPagerView;

import java.util.List;

import yuejian_07.yuejian_07.R;
import yuejian_07.yuejian_07.activity.ModifyUserActivity;
import yuejian_07.yuejian_07.activity.NoticeListActivity;
import yuejian_07.yuejian_07.activity.YijianfankuiActivity;
import yuejian_07.yuejian_07.activity.YuejianInfoActivity;
import yuejian_07.yuejian_07.adapter.NoticeListAdapter;
import yuejian_07.yuejian_07.javabean.Notice;

/**
 * Created by dell on 2017/10/19.
 */

public class UserFragment extends Fragment {
    private RecyclerView recyclerView;
    private List mDataList;

    private int u_id;
    private View view=null;
    private RollPagerView rollPV = null;
    private ImageButton xiaoxi,dingdan,ic_goin1,ic_goin2,ic_goin;

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState)
    {
        view=inflater.inflate(R.layout.tab05_me, container, false);

        initViews();
        initEvents();
        initData();

        return view;

    }

    private void initViews() {


        xiaoxi=(ImageButton) view.findViewById(R.id.xiaoxi);
        dingdan=(ImageButton) view.findViewById(R.id.dingdan);
        ic_goin1=(ImageButton) view.findViewById(R.id.imageButton1);
        ic_goin2=(ImageButton) view.findViewById(R.id.imageButton2);
        ic_goin=(ImageButton) view.findViewById(R.id.imageButton);



    }


    private void  initEvents(){
        xiaoxi.setOnClickListener(new View.OnClickListener(){//购买跳转
            @Override
            public void onClick(View v){
                Intent intent = new Intent(UserFragment.this.getActivity(), NoticeListActivity.class);
                startActivity(intent);
            }
        });
        ic_goin1.setOnClickListener(new View.OnClickListener(){//购买跳转
            @Override
            public void onClick(View v){
                Intent intent = new Intent(UserFragment.this.getActivity(), YuejianInfoActivity.class);
                startActivity(intent);
            }
        });

        ic_goin2.setOnClickListener(new View.OnClickListener(){//购买跳转
            @Override
            public void onClick(View v){
                Intent intent = new Intent(UserFragment.this.getActivity(), YijianfankuiActivity.class);
                startActivity(intent);
            }
        });
        ic_goin.setOnClickListener(new View.OnClickListener(){//购买跳转
            @Override
            public void onClick(View v){
                Intent intent = new Intent(UserFragment.this.getActivity(), ModifyUserActivity.class);
                startActivity(intent);
            }
        });

    }

    private void initData()
    {



    }
    public void onSuccess(List<Notice> data){

        //System.out.printf("data");
        recyclerView.setAdapter(new NoticeListAdapter(UserFragment.this.getActivity(),data));
    }



    public void onFail(){ Toast.makeText(getActivity(), "网络发生错误", Toast.LENGTH_SHORT).show();}

}
